package top.drinyeit.weilong.util;

import android.databinding.BindingAdapter;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;

import top.drinyeit.weilong.R;

/**
 * Created by YJY on 2017/10/22.
 */

public class ImageLoadUtil {

    @BindingAdapter({"imageUrl"})
    public static void getInternetImage(ImageView imageView, String imageUrl) {
        if (imageUrl != null) {
            Glide
                    .with(imageView.getContext())
                    .load(imageUrl)
                    .placeholder(R.drawable.ic_def)
                    .dontTransform()
                    .diskCacheStrategy(DiskCacheStrategy.SOURCE)
//                    .apply(new RequestOptions().placeholder(R.drawable.ic_placeholder))
                    .into(imageView);
        }
    }
}
